#ifndef STRITER_H
#define STRITER_H

class StraightIter
{
	public:
		StraightIter(uint8* counts);

		bool8 findStraight(bool8 allowJoker, bool8 firstTime);

		uint8* getStart();
		uint8* getWild();
		uint8* getProbe();
		int32 getLen();

		int32 getStartRank();

	protected:
		bool8 findRun(bool8, bool8);

		bool8 firstRun(bool8);
		bool8 nextRun(bool8);

		bool8 aceLowRun(bool8);

		void insertWild();
		void findEnd();

	private:
		enum Flags
		{
			SI_NORMALDONE	= 0x00000001L,	// no more non-ace-low straights
			SI_ACEDONE		= 0x00000002L	// tried ace-low straight
		};

		uint8 *counts, *start, *probe, *wild;
		int32 runLen, flags;
};

inline uint8* 
StraightIter::getStart()
{
	return start;
}

inline uint8* 
StraightIter::getWild()
{
	return wild;
}

inline uint8*
StraightIter::getProbe()
{
	return probe;
}

inline int32 
StraightIter::getLen()
{
	return runLen;
}

#endif
